home *** CD-ROM | disk | FTP | other *** search
MarxMenu script | 1991-03-27 | 8.3 KB | 320 lines |
- Comment
- =========================================================
-
- MarxMenu installation Menu:
-
- Copyright 1989-1991 by Marc Perkel * All rights reserved.
-
- This is an example of how MarxMenu can be used as a job control
- language. There is quite an education in MarxMenu tricks here. If
- you want to write a similar program, this menu is worth studying.
-
- =========================================================
- EndComment
-
- Var
- VertLine = "┬│││││││││││││││││││││││││││││││││││││││││││││"
- EchoSt
- FileLine
- ProgName
- NewDos
- BatExit
- EchoTail
- ConfigSysPath
- ConfigSysLines
- WorkStr
-
- Const
- PauseTime = 100
-
- DelFile 'MENUS.EXE'
-
-
- if ColorScreen
- TextColor Cyan Blue
- ClearScreen 176
- GotoXY 1 25
- TextColor Yellow Mag
- ClearLine
- WriteCenter 'MarxMenu Version ' MarxVersion ' * Copyright 1989-91 by Marc Perkel'
- BoxBorderColor White Brown
- BoxInsideColor Yellow Brown
- BoxHeaderColor Yellow Mag
- ClockColor Yellow Brown
- TextColor Yellow Brown
- else
- ClearScreen 176
- TextColor Black Grey
- GotoXY 1 25
- ClearLine
- WriteCenter 'Copyright 1989 by Marc Perkel * All Rights Reserved'
- BoxBorderColor Black Grey
- BoxInsideColor Black Grey
- BoxHeaderColor Black Grey
- ClockColor Black Grey
- endif
-
- SingleLineBox
- Explode Off
- DrawBox 1 1 80 3
- GotoXY (54,1)
- Write "MarxMenu Installation"
- ClockPos 3 2
-
- BlankTime = 10
- ScrollMove Off
-
- Explode On
- Shadow Off
- BlockBox
- InverseColor Yellow Red
-
- BoxBorderColor Yellow Mag
- BoxInsideColor Mag Mag
- DrawBox 10 6 61 17
- BoxBorderColor LGreen Blue
- BoxInsideColor Yellow Blue
- Shadow On
-
- DrawBox 35 13 11 3
- WriteCenter 'The'
- Loop 5
- MoveWindow -4 -1
- Wait 3
- EndLoop
-
- DrawBox 35 13 11 3
- WriteCenter 'Marx'
- Loop 5
- MoveWindow 4 -1
- Wait 3
- EndLoop
-
- DrawBox 35 13 11 3
- WriteCenter 'Menu'
- Loop 5
- MoveWindow -4 1
- Wait 3
- EndLoop
-
- DrawBox 35 13 11 3
- WriteCenter 'System'
- Loop 5
- MoveWindow 4 1
- Wait 3
- EndLoop
-
- Wait 20
- DrawBox 25 13 31 3
- WriteCenter 'Installation Menu'
- Wait 250
- RollWindow 4
- EraseTopWindow
- Wait 20
- RollWindow 3
- EraseTopWindow
- Wait 20
- RollWindow 2
- EraseTopWindow
- Wait 20
- RollWindow 1
- EraseTopWindow
- Wait 20
- EraseTopWindow
-
- Shadow Off
- DrawBox 25 11 31 7
-
- NewDos = DosVersionString >= '3.30'
-
-
-
- ;MXECHO is a debugging environment variable. Use SET MXMENU=OFF for
- ;normal use. SET MXECHO=ON to watch the MARX.BAT run.
-
- If ReadEnv('MXECHO') > ''
- EchoTail = '%MXECHO%'
- Else
- EchoTail = 'OFF'
- EndIf
-
- if NewDos
- EchoSt = '@ECHO ' + EchoTail
- else
- EchoSt = 'ECHO ' EchoTail
- endif
-
-
- ProgName = CleanFileName(Path + '\MARXMENU.EXE')
-
- Write ' Creating MARX.BAT ... '
-
- ;----- BatExit is a 0k bat file used to exit batch files
-
- FileAssign (BatExit,'BATEXIT.BAT')
- FileCreate BatExit
- FileClose BatExit
-
- FileLine[1] = EchoSt
- FileLine[2] = ProgName + ' %1 ' + Path
- FileLine[3] = '%MXCMD%'
- FileLine[4] = '%0 %1'
-
- FileLine[6] = '*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*'
-
- FileLine[8] = 'MarxMenu * CopyRight 1989-91 by Marc Perkel'
-
- FileLine[10] = 'If you are having trouble getting MarxMenu to work,'
- FileLine[11] = 'the first line of this file can be changed to ECHO ON.'
-
- FileLine[13] = 'MarxMenu controls this batch file by writing to the environment'
- FileLine[14] = 'variable MXCMD. %0 = MARX.BAT and restarts this batch file.'
-
- FileLine[16] = 'MXSTOP.BAT is executed to exit this batch file.'
- FileLine[17] = 'The third parameter in line 2 is the directory where temporary'
- FileLine[18] = 'batch files are created.'
-
- FileLine[20] = '*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*'
-
- FileLine[22] = ' MARX.BAT'
- FileLine[23] = ' -------- +-------MarxMenu Creates--+'
- FileLine[24] = ' +----> @ECHO OFF | |'
- FileLine[25] = ' | C:\MARX\MARXMENU.EXE %1 C:\MARX |'
- FileLine[26] = ' | %MXCMD% ->---+ +-> $MX00000.BAT'
- FileLine[27] = ' | +--> %0 %1 --+ | ------------'
- FileLine[28] = ' | | | +---------------------------> CD\WORDSTAR'
- FileLine[29] = ' +-|------<-----+ WS --+'
- FileLine[30] = ' | |'
- FileLine[31] = ' +--------------------------------------------------<-+'
-
- FileLine[33] = 'Note: MarxMenu sets MXCMD = CALL $MX00000.BAT'
-
- FileLine[35] = '*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*'
-
- WriteTextFile 'MARX.BAT' FileLine
- Dispose FileLine
-
- Writeln
- Write ' Creating DROPTO.BAT ... '
-
- FileLine[1] = 'DEL %1'
- FileLine[2] = 'SET KSV='
- FileLine[3] = 'SET MXCMD='
- FileLine[4] = '%2 %3 %4 %5 %6 %7 %8 %9'
- FileLine[5] = 'BATEXIT'
-
- FileLine[7] = '*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*'
-
- FileLine[9] = 'DropTo is used when you want to eliminate the temporary batch'
- FileLine[10] = 'file created by MarxMenu. This is useful if you shell to DOS'
- FileLine[11] = 'and then run MarxMenu from the dos shell. It avoids the'
- FileLine[12] = '"Missing Batch File" error.'
-
- FileLine[14] = 'DropTo is run from within the temporary batch file you want'
- FileLine[15] = 'to eliminate.
-
- FileLine[17] = 'Usage: DROPTO %0 <command line>'
-
- FileLine[19] = "Here's how it works:"
-
- FileLine[21] = ' $MX00000.BAT <------deletes this file--------+'
- FileLine[22] = ' ------------ |'
- FileLine[23] = ' DROPTO %0 COMMAND.COM ------------> DEL %1 >-+'
- FileLine[24] = ' SET KSV='
- FileLine[25] = ' SET MXCMD='
- FileLine[26] = ' %2 executes command.com--> %2 %3 %4 %5 %6 %7 %8 %9'
-
- FileLine[28] = '*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*'
-
- WriteTextFile 'DROPTO.BAT' FileLine
- Dispose FileLine
-
- Writeln
- Write ' Creating MXSTOP.BAT ... '
-
- FileLine[1] = 'SET MXCMD='
- FileLine[2] = 'SET KSV='
- FileLine[3] = 'REM From here, you control the menu exit process!'
-
- WriteTextFile 'MXSTOP.BAT' FileLine
- Dispose FileLine
-
- Writeln
- Write ' Creating GOFILE.BAT ... '
-
- FileLine[1] = EchoSt
- FileLine[2] = 'MARXMENU GOFILE %1'
- FileLine[3] = 'REM This batch file is used only with the GOFILE menu.'
-
- WriteTextFile 'GOFILE.BAT' FileLine
-
- Writeln
- Wait PauseTime
- EraseTopWindow
-
- CheckEnvSize
-
- EraseTopWindow
- BoxBorderColor Yellow Mag
- BoxInsideColor White Mag
- DrawBox 18 10 44 7
- BoxBorderColor LGreen Blue
- BoxInsideColor Yellow Blue
- DrawBox 23 12 34 3
- WriteCenter 'MarxMenu Installed!'
- Wait PauseTime * 2
- EraseTopWindow
- EraseTopWindow
-
- ExitMenu
-
- ;--- Menu Exits Here
-
- ;===================== Procedures ========================
-
- ;--- Check the environment size
-
- Procedure CheckEnvSize
- var NeededSpace ShellCommand
- if EnvFree < 150
- ConfigSysPath = ExistOnPath( 'CONFIG.SYS' )
- NeededSpace = (EnvFree + 160) / 16 * 16
- if DosVersionString < '3.30'
- ShellCommand = Str(NeededSpace / 16)
- else
- ShellCommand = Str(NeededSpace)
- endif
- if ConfigSysPath <> ''
- BoxBorderColor LCyan Blue
- BoxInsideColor White Blue
- DrawBox 15 8 51 13
- WriteCenter '* Warning! *'
- Writeln char(7)
- Writeln ' You have a total of ' EnvSize ' bytes of environment'
- Writeln ' space with only ' EnvFree ' bytes free. MarxMenu'
- Writeln ' requires about 150 bytes of free environment'
- Writeln ' space. You should modify you CONFIG.SYS file'
- Writeln ' as follows:'
- Writeln
- WriteCenter 'SHELL=COMMAND.COM /P /E:' ShellCommand
- Writeln
- Writeln
- WriteCenter( ' * Press any Key to Continue * ' )
- Cursor Off
- LastKey = ReadKey
- EraseTopWindow
- else
- ReadTextFile( ConfigSysPath,ConfigSysLines )
- Loop( NumberOfElements( ConfigSysLines ) )
- WorkStr = UpperCase( ConfigSysLines[LoopIndex] )
- If ( NextWord( WorkStr ) = 'SHELL' )
- Delete( ConfigSysLines,LoopIndex,1 )
- EndIf
- EndLoop
- ConfigSysLines[NumberOfElements( ConfigSysLines ) + 1] =
- 'SHELL=COMMAND.COM /P /E:' + ShellCommand
- WriteTextFile( ConfigSysPath,ConfigSysLines )
- endIf
- endIf
- EndProc